import socket
import struct

s = socket.socket()
host = socket.gethostname()
print host
host = '127.0.0.1'
port = 8000
s.bind((host,port))

s.listen(3)


while True:	
	# send data to client
	print 'server waiting...'
	
	c,addr = s.accept()
	print 'Got conn from',addr
	while True:
		try:

			data = c.recv(12)
			print 'macaddr:',data
		except:
			print 'exception occur'
			c.close()
			break
		if not data:
			break
		
	c.close()

raw_input()
